#include<iostream.h>
void menu();
int top=0;
class stack {
				 private:
							char a[10];
				 public:
							void push(char);
							char pop();
							int isfull();
							int isempty();
							void displaystack();
				};

void stack::push(char x) {
									if(isfull()) {
														a[top]=x;    top++;
													 }
									else
										 cout<<"\nstack full\n";
								 }

char stack::pop(){
						 if(isempty()) {
											  top--;   return a[top];
											}
						 else
								return -1;
						}

int stack::isfull() {
							if(top==10)    return 0;
							else           return 1;
						  }

int stack::isempty() {
							  if(top==0)     return 0;
							  else           return 1;
							}

void stack::displaystack()  {
										int i;
										for(i=top-1;i>=0;i--)
										cout<<a[i];
									 }

int main() {
				 int c;
				 char x,y;
				 stack s1;
				 menu();
				 cin>>c;
				 while(c!=4) {
									switch(c) {
													case 1:
															  cin>>x;   s1.push(x);   break;
													case 2:
															  y=s1.pop();
															  if(y==-1)
																			cout<<"stack empty";
																break;
													case 3:
																s1.displaystack();       break;
												  }
										menu();
										cin>>c;
									  }
				 return 0;
				}

void menu()
{
cout<<"\n1.insert item\n2.delete item\n3.print item\n4.exet\n";
}
